import d0801_my_bar,d0725_my_pie,d0126_my_mline,d0225_my_line
import numpy as np
import json,pprint

stars = []
pro_name = []
ai_stat = ["on_ai","off_ai"]
ai_stat_num = []
no_ai = 0
yes_ai = 0

if __name__ == '__main__':
    with open(r"D:\python\exercise.json","r") as jj:
        gits = json.load(jj)

    for i in gits[:14]:
        stars.append(i.get('stargazers_count'))
        pro_name.append(i.get('full_name')[:30])
        if  "ai" in i["topics"]:
            yes_ai+=1
        else:
            no_ai+=1
    ai_stat_num.append(yes_ai)
    ai_stat_num.append(no_ai)

    # pie = d0725_my_pie.My_Pie(ai_stat,ai_stat_num,2,
    #                           "How many AI projects in first 15th",
    #                           "The proportions to colors")
    # pie_name = pie.show_pie()
    #
    # bar = d0801_my_bar.My_Bar(pro_name,stars,title="The projects' popularities" )
    # bar_name = bar.show_bar()

    mulline = d0126_my_mline.My_Mulline(pro_name)
    mulline.add_line(stars,"dashdot")
    mul_name = mulline.show_lines()

    line = d0225_my_line.My_Line(pro_name,stars)
    line_name = line.show_line()

    with open(r"/jeulgeopge.html", "w", encoding="utf-8") as html:
        graph = d0225_my_line.Graph_Page(html,)
        graph.create_page([mul_name,line_name])

























